-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PM-16102] Increase clickable area for bit-item actions #12450
Conversation
New Issues
Fixed Issues
|
Codecov ReportAttention: Patch coverage is
✅ All tests successful. No failed tests found.
Additional details and impacted files@@ Coverage Diff @@
## main #12450 +/- ##
==========================================
+ Coverage 33.56% 33.59% +0.02%
==========================================
Files 2926 2926
Lines 91527 91443 -84
Branches 17395 17376 -19
==========================================
- Hits 30721 30717 -4
+ Misses 58392 58311 -81
- Partials 2414 2415 +1 ☔ View full report in Codecov by Sentry. |
@@ -8,5 +8,9 @@ import { A11yCellDirective } from "../a11y/a11y-cell.directive"; | |||
imports: [], | |||
template: `<ng-content></ng-content>`, | |||
providers: [{ provide: A11yCellDirective, useExisting: ItemActionComponent }], | |||
host: { | |||
class: | |||
"[&>button]:tw-relative [&>button:not([bit-item-content])]:before:tw-content-[''] [&>button]:before:tw-absolute [&>button]:before:tw-block [&>button]:before:tw-top-[-0.75rem] [&>button]:before:tw-bottom-[-0.75rem] [&>button]:before:tw-right-[-0.25rem] [&>button]:before:tw-left-[-0.25rem]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ℹ️ The not([bit-item-content])
is to prevent the :before
area being added to the main item action, which also uses the item-action
component.
@@ -8,5 +8,9 @@ import { A11yCellDirective } from "../a11y/a11y-cell.directive"; | |||
imports: [], | |||
template: `<ng-content></ng-content>`, | |||
providers: [{ provide: A11yCellDirective, useExisting: ItemActionComponent }], | |||
host: { | |||
class: | |||
"[&>button]:tw-relative [&>button:not([bit-item-content])]:before:tw-content-[''] [&>button]:before:tw-absolute [&>button]:before:tw-block [&>button]:before:tw-top-[-0.75rem] [&>button]:before:tw-bottom-[-0.75rem] [&>button]:before:tw-right-[-0.25rem] [&>button]:before:tw-left-[-0.25rem]", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓
In bit-item-content
, we define the Y padding as tw-py-2 bit-compact:tw-py-1.5
. The padding hooks into compact mode. My understanding is that the position properties here should be 1:1 with the padding, right? p-1.5 === .375rem
and p-2 === .5rem
And if these values are meant to be coupled, would it be helpful to represent them as a shared CSS variable? --bit-item-x-padding
etc? Then we could use the same variable in both places? Just wondering if we are worried about accidentally breaking this in the future if it is meant to be lockstep, but not actually lockstep.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hm yeah it probably should be. I think I was eyeballing whether or not it looked like the right height and never went back and updated it
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For posterity, they don't match because the padding units have a different origin point than the positioning units, but they are updated to be more accurate and responsive to compact mode in this commit: fc4c0eb
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ In storybook, verified bit-item actions click area now includes to top/bottom padding on the bit-item
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Component({ | ||
selector: "span[bitBadge], a[bitBadge], button[bitBadge]", | ||
providers: [{ provide: FocusableElement, useExisting: BadgeDirective }], | ||
providers: [{ provide: FocusableElement, useExisting: BadgeComponent }], | ||
imports: [CommonModule], | ||
templateUrl: "badge.component.html", | ||
standalone: true, | ||
}) | ||
export class BadgeDirective implements FocusableElement { | ||
export class BadgeComponent implements FocusableElement { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an FYI, this is a breaking change. Since an element can only have one component attached, it was possible to do <span bitBadge my-other-component>
before this PR. After this PR, it would error.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, the Angular style guide suggests kebab-case for components, and pascalCase for directives. However, we are not consistently following this, and I don't think it is worth the code diff as part of this PR.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll do a quick check for any bitBadge
instances doing that before I merge.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, ty
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Focus ring padding fixed! Thanks!
🎟️ Tracking
PM-16102
📔 Objective
This PR increases the clickable area for each trailing
bit-item
action button so that the buttons are more accessible. To do so, we had to make a modification to thebit-badge
(:before
does not work when you haveoverflow:hidden
, so we needed to move that property to an interior layer of badge), which necessitated changing it from a directive to a component. This should not affect any usages of the badge.📸 Screenshots
Before:
Screen.Recording.2024-12-18.at.10.07.23.AM.mov
After:
Screen.Recording.2024-12-17.at.2.38.18.PM.mov
⏰ Reminders before review
🦮 Reviewer guidelines
:+1:
) or similar for great changes:memo:
) or ℹ️ (:information_source:
) for notes or general info:question:
) for questions:thinking:
) or 💭 (:thought_balloon:
) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion:art:
) for suggestions / improvements:x:
) or:warning:
) for more significant problems or concerns needing attention:seedling:
) or ♻️ (:recycle:
) for future improvements or indications of technical debt:pick:
) for minor or nitpick changes